<!DOCTYPE html>
<html>
<head>
<title>修改密码</title>
#include("/admin/_common/head.html")
<!-- 样 式 文 件 -->
</head>
<!-- 代 码 结 构 -->
<body class="pear-container">
    <form class="layui-form layui-form-pane">
        <div class="main-container">
            <div class="layui-form-item">
                <label class="layui-form-label required">旧密码</label>
                <div class="layui-input-block">
                    <input name="oldPassword" type="password" placeholder="请输入旧密码" lay-verify="required|oldPassword" autocomplete="off" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">新密码</label>
                <div class="layui-input-block">
                    <input name="newPassword" type="password" placeholder="请输入新密码" lay-verify="required|newPassword" autocomplete="off" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">确认密码</label>
                <div class="layui-input-block">
                    <input name="confirmPassword" type="password" placeholder="请输入确认密码" lay-verify="required|confirmPassword" autocomplete="off" class="layui-input" />
                </div>
            </div>
        </div>
        <div class="bottom" style="display: none;">
            <div class="button-container">
                <button type="submit" class="pear-btn pear-btn-primary pear-btn-xs" lay-submit="" lay-filter="data-save" id="data-save">
                    <i class="layui-icon layui-icon-ok"></i> 提交
                </button>
            </div>
        </div>
    </form>
    <!-- 资 源 引 入 -->
#include("/admin/_common/foot.html")
#include("/admin/_common/form_style.html")
    <script>
    layui.use(['form', 'jquery', 'common'], function() {
        let $ = layui.jquery;
        var form = layui.form;
        var common = layui.common;
        
        /*
         * 自定义验证规则
         */
        form.verify({
            oldPassword : function(value, item) {
                if (value.length < 6 || value.length > 128) {
                    return '当前密码必须6到128位字符';
                }
            },
            newPassword : function(value, item){
                if (value.length < 6 || value.length > 128) {
                    return '新密码必须6到128位字符';
                }
            },
            confirmPassword : function(value, item){
                if (value != $('[name="confirmPassword"]').val()) {
                    return '确认密码必须和新密码相同';
                }
            }
        });
    });
    </script>
</body>
</html>
